// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import '@/assets/scss/index.scss'
import '@/assets/scss/search.scss'
import 'element-ui/lib/theme-chalk/index.css'
import rule from '@/config/filteringRule'
import store from '@/config/store'
import validation from '@/config/validationRules'
import ElementUi from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import daohanganniu from "./components/daoHangAnNiu.vue";
import hyTable from './components/webTable'
import hySearch from './components/webSearch'
import hyform from './components/webForm'
import popBtn from './components/popBtn'
import popForm from './components/popForm'
import axios from 'axios'
import x2js from 'x2js'
import Aside from './components/Aside'
import echarts from 'echarts'

Vue.prototype.$echarts = echarts
Vue.config.productionTip = false
Vue.prototype.$rule = rule
Vue.prototype.store = store
Vue.prototype.validation = validation
Vue.prototype.$ajax = axios
Vue.prototype.$x2js = new x2js()
Vue.component('daohang-nav', daohanganniu)
Vue.component('hy-table', hyTable)
Vue.component('hy-form', hyform)
Vue.component('hy-search', hySearch)
Vue.component('pop-Btn', popBtn)
Vue.component('pop-Form', popForm)
Vue.component('pop-form', popForm)
Vue.component('hy-Aside', Aside)
Vue.use(ElementUi)
Vue.filter("groupTypeNULLTrans", function (value) {
  console.log(value)
  if (value == null) {
    console.log(value == null)
    return 0;
  } else {
    return value;
  }
}), Vue.filter("formatType", function (data) {
  if (data == 1) {
    return '投诉'
  } else if (data == 2) {
    return '售后'
  } else if (data == 3) {
    return '服务'
  } else if (data == 4) {
    return '市场信息'
  } else if (data == 5) {
    return '咨询'
  } else if (data == 6) {
    return '服务站'
  } else if (data == 7) {
    return '其他'
  }
}),
  Vue.prototype.DateGeshi_Int = function (datetime, format) {// /Date(1593582529980)/ 格式
    if (datetime == null) {
      return "--"
    }
    console.log(datetime, new Date(datetime))
    var dateTime = new Date(parseInt(datetime.substr(6, datetime.length - 2)));
    format = format.replace("yyyy", dateTime.getFullYear());
    format = format.replace("yy", dateTime.getFullYear().toString().substr(2));
    format = format.replace("MM", (dateTime.getMonth() + 1) < 10 ? ("0" + (dateTime.getMonth() + 1)) : (dateTime.getMonth() + 1))
    format = format.replace("dd", (dateTime.getDate() < 10 ? ("0" + dateTime.getDate()) : dateTime.getDate()));
    format = format.replace("hh", (dateTime.getHours() < 10 ? ("0" + dateTime.getHours()) : dateTime.getHours()));
    format = format.replace("mm", (dateTime.getMinutes() < 10 ? ("0" + dateTime.getMinutes()) : dateTime.getMinutes()));
    format = format.replace("ss", (dateTime.getSeconds() < 10 ? ("0" + dateTime.getSeconds()) : dateTime.getSeconds()));
    format = format.replace("ms", dateTime.getMilliseconds());
    return format;
  };
Vue.prototype.DateGeshi_Date = function (datetime, format) { // new Date
  if (datetime == null) {
    return "--";
  }
  let dateTime = new Date(datetime);
  format = format.replace("yyyy", dateTime.getFullYear());
  format = format.replace("yy", dateTime.getFullYear().toString().substr(2));
  format = format.replace("MM", (dateTime.getMonth() + 1) < 10 ? ("0" + (dateTime.getMonth() + 1)) : (dateTime.getMonth() + 1))
  format = format.replace("dd", (dateTime.getDate() < 10 ? ("0" + dateTime.getDate()) : dateTime.getDate()));
  format = format.replace("hh", (dateTime.getHours() < 10 ? ("0" + dateTime.getHours()) : dateTime.getHours()));
  format = format.replace("mm", (dateTime.getMinutes() < 10 ? ("0" + dateTime.getMinutes()) : dateTime.getMinutes()));
  format = format.replace("ss", (dateTime.getSeconds() < 10 ? ("0" + dateTime.getSeconds()) : dateTime.getSeconds()));
  format = format.replace("ms", dateTime.getMilliseconds());
  return format;
};
/*console.log(this.DateGeshi_Date(new Date('2020-06-20 17:50:28'),"yyyy-MM-dd hh:mm:ss"),'KKK')*/
Vue.prototype.ToBool = function (kkkkk) {
  return (/^true$/i).test(kkkkk);
};
Vue.prototype.addDays = function (Dateform, days) {
  var d = new Date(Dateform)
  d.setMilliseconds(d.getMilliseconds() + (days * 24 * 60 * 60 * 1000));
  var month = d.getMonth() + 1;
  var day = d.getDate();
  if (month < 10) {
    month = "0" + month;
  }
  if (day < 10) {
    day = "0" + day;
  }
  var val = d.getFullYear() + "-" + month + "-" + day;
  return val;
},
  /*console.log(this.ToBool(undefined),7777)*/
  /* eslint-disable no-new */
  new Vue({
    el: '#app',
    router,
    components: {App},
    template: '<App/>'
  })
